const fs = require('fs');
const path = require('path');
var tools = require('../../../libs/tools');
var config = require(tools.rootPath + 'config');
var { connection, pool, model } = require(tools.rootPath + 'libs/model');

var controller = require(tools.rootPath + 'libs/controller.js');

var email = require("emailjs/email");

module.exports = class extends controller {
    constructor() {
        super();
    }
    index(req, res) {
        var server = email.server.connect({
            user: "2485416205@qq.com",//发件人的qq邮箱账号
            password: "",//发件人的qq邮箱密码
            host: "smtp.qq.com",
            ssl: true
        });

        server.send({
            text: "邮件正文",
            from: "2485416205@qq.com",//你的qq邮箱账号
            to: "2485416205@qq.com",//收件人邮箱
            subject: "node.js邮件测试",
        }, function (err, message) {
            if (err) {
                console.log('发生了错误', err);
            } else {
                console.log('发送成功');
            }
        });

        res.end('ok');

    }
}